package form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class ConnexionForm extends ActionForm{
	
	private String userId;
	private String usrMdp;
	
	public ConnexionForm()
	{
		super();
	}
	
	public void reset(ActionMapping mapping, HttpServletRequest request)
	{
		this.userId=null;
		this.usrMdp=null;
	}
	
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
	{
		ActionErrors errors = new ActionErrors();
		
		if ((userId == null) || (userId.length() < 1)) {
            errors.add("userId", new ActionMessage("errors.userId.required"));
        }

        // Secret Phrase must be entered
        if ((usrMdp == null) || (usrMdp.length() < 1)) {
            errors.add("usrMdp", new ActionMessage("errors.usrMdp.required"));
        }
        
		return(errors);
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUsrMdp() {
		return usrMdp;
	}

	public void setUsrMdp(String usrMdp) {
		this.usrMdp = usrMdp;
	}

}
